﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using L = Science.Mathematics.LinearAlgebra;

namespace Strang3Ed.Chapter04.Section2
{
    public class Example03
    {
        public Example03()
        {
        }
        private string result;
        public string Result
        {
            get { return result; }
        }
        public void Compute()
        {
            double[,] x = { {1.0, 0.0}, 
                           {1.0, 1.0},
                           {1.0, 2.0}};

            L.Matrix A = new L.Matrix(x);

            L.Vector b = new L.Vector(3);
            b[0] = 6.0;
            b[1] = 0.0;
            b[2] = 0.0;

            L.Subspace s = new L.Subspace(A);

            L.Projection obj = new L.Projection(s, b);

            result += obj.OntoSubspace.ToString() + "\r\n";

            result += obj.Error.ToString() + "\r\n";
        }
    }
}
/*
5
2
-1

1
-2
1
*/
